import 'package:flutter/material.dart';
import 'package:fortest/main.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

class RefreshWidget extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return _RefershState();
  }
}

/*
class _RefershState extends State<RefreshWidget>{
  GlobalKey<EasyRefreshState> _easyRefreshKey = new GlobalKey<EasyRefreshState>();
  GlobalKey<RefreshHeaderState> _headerKey = new GlobalKey<RefreshHeaderState>();
  GlobalKey<RefreshFooterState> _footerKey = new GlobalKey<RefreshFooterState>();

  Widget getItem(){
    return Container(
      height: 50,
      child: Text('你您适得府君书看对方水电费健康'),
    );
  }

  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: AppBar(
        title: Text('测试'),
      ),
      body: EasyRefresh(
        key: _easyRefreshKey,
         autoLoad: true,
            firstRefresh: true,
            behavior: ScrollOverBehavior(),
            refreshHeader: ClassicsHeader(
              key: _headerKey,
              refreshText: "下拉刷新",
              refreshReadyText:  "松开后开始刷新",
              refreshingText:  "正在刷新...",
              refreshedText: "刷新完成",
              moreInfo:  "",
              bgColor: Colors.transparent,
              textColor: Colors.black87,
              moreInfoColor: Colors.black54,
              showMore: true,
            ),
            refreshFooter: ClassicsFooter(
              key: _footerKey,
              loadText: "上拉加载更多",
              loadReadyText: "松开后开始加载",
              loadingText: "正在加载...",
              loadedText: "加载完成",
              noMoreText: "没有更多内容了",
              moreInfo: "",
              bgColor: Colors.transparent,
              textColor: Colors.black87,
              moreInfoColor: Colors.black54,
              showMore: true,
            ),
        child:
      ListView.builder(
        itemBuilder: (context,int){
          return getItem();
        },
        itemCount: 10,
      ),
      onRefresh:  (){
          // this._curPage=1;
          // this._loadData(this._curPage);
        },
        loadMore:()async{
          // this._curPage++;
          // this._loadData(this._curPage);
        } ,
    ));
  }

}
*/

class _RefershState extends State<RefreshWidget>{

  Widget getItem(){
    return Container(
      height: 50,
      child: Text('你您适得府君书看对方水电费健康'),
    );
  }

  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: AppBar(
        title: Text('测试'),
      ),
      body:
      EasyRefresh.custom(
        slivers: <Widget>[
          Container(
            height: 50,
            child: Text('对方水电费收费'),
          )
        ],
        onRefresh: () async{
          
        },
        onLoad: () async {

        },
  )
      );
  }

}